FROM golang:latest as build
ENV GOPROXY https://goproxy.cn
ENV http_proxy ""
ENV https_proxy ""
ENV GO111MODULE on
ENV GOSUMDB off

WORKDIR /tmp/cache

COPY ./server/go.mod .
COPY ./server/go.sum .

RUN go mod download

WORKDIR /usr/server/app

COPY ./server ./
RUN GOOS=linux CGO_ENABLED=0 go build -ldflags="-s -w" -installsuffix cgo -o app main.go

CMD ["./app"]
